package com.arges.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 * TODO
 * </p>
 *
 * @author fanweitao
 * @date 2023/02/02
 */
@RestController
public class Test6 {


    public static void main(String[] args) {

        Map<String, Object> map = new HashMap<>();
        map.put("camera_id", 1234);
        map.put("stream_type", 0);
        map.put("appid", "appId");
        System.out.println(map);
        System.out.println(map.toString());
        JSONObject object = new JSONObject();
        object.put("data", map);
        System.out.println("object==>" + object);

        String str = object.toJSONString();
        JSONObject data = JSON.parseObject(str);
        System.out.println("data==>" + data);
        String pan = JSON.parseObject(data.getString("data")).getString("appid");
        System.out.println("pan==>" + pan);
    }
}
